【例子介绍】Delphi条件个数不定的判断
【相关图片】
【源码结构】var
Bln:boolean;
p:byte;
Arr:array of string;
TS:Tstringlist;
TJStr,TJVal,tmp,sname:string;
begin
meo.Clear;
rcount:=grid.RowCount;
ts:=tstringlist.Create;
ncount:=checklist.Items.Count;
for n:= 0 to nCount-1 do
begin
if checklist.Checked[n]=true then
ts.Add(checklist.Items.Strings[n]);
end;
ncount:=ts.count;
if ncount=0 then exit;
meo.Lines.Add('符合条件的如下:');
setlength(arr,ncount);
for n:= low(arr) to high(arr) do
arr[n]:=ts[n];
for r:=1 to rcount-1 do
begin
bln:=true;
for n:= low(arr) to high(arr) do
begin
tmp:=arr[n];
p:=pos('=',tmp);
TJStr:=copy(tmp,1,p-1);
if TJStr='技术' then
f:=2
else if TJStr='种类' then
f:=3
else if TJStr='级别' then
f:=4
else if TJStr='派系' then
f:=5;
TJVal:=copy(tmp,p 1,length(tmp)-p);
if trim(grid.Cells[f,r])<>TJVal then
begin
bln:=false;
break;
end;
end;
if bln=true then
meo.Lines.Append(' ' grid.Cells[1,r]);
end;
meo.Refresh;
评论